Skip to content

FIX: support phasespace v2.0 - #606

Open
redeboer wants to merge 2 commits into
mainfrom
support-phasespace-2
Open

redeboer wants to merge 2 commits into
mainfrom
support-phasespace-2

Conversation

@redeboer

@redeboer redeboer commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

🐛 Bug fixes

  • TFPhaseSpaceGenerator and TFWeightedPhaseSpaceGenerator work with phasespace 2.0. They now select the phasespace backend explicitly instead of relying on its default, which became NumPy in 2.0. With the default "tensorflow" backend, the generators produce exactly the same samples for the same seed as before. phasespace 1.x keeps working for the TensorFlow backend.

⚙️ Enhancements

  • Both generators get a keyword-only backend argument that accepts "tensorflow" (default), "numpy", or "jax". NumPy and JAX require phasespace 2.0. The generators always return NumPy arrays.
  • The generators accept any RealNumberGenerator, instead of raising a TypeError for anything other than a TFUniformRealNumberGenerator. A generator that does not belong to the selected backend provides an integer seed, so samples stay reproducible.

This PR extracts the non-breaking part of #599 for a 0.4.18 patch release. The phsp extra still installs TensorFlow, and the class names keep their TF prefix.

📝 Documentation

  • The phase space page gets a section on backends that shows which extra each backend requires and how each one uses the given RealNumberGenerator.

Squash commit messages

* DOC: show how to select the phase space backend
* ENH: accept any random number generator in phase space generators
* ENH: support selecting the phase space backend

@redeboer redeboer added this to the 0.4.18 milestone Nov 17, 2026
@redeboer redeboer added 🐛 Bug Something isn't working ⚙️ Enhancement Improvements and optimizations of existing features labels Nov 17, 2026
@redeboer redeboer self-assigned this Nov 17, 2026

@redeboer redeboer left a comment •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'TensorWaves benchmark results'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 3f01afb Previous: d87354f Ratio
benchmarks/expression.py::test_fit[1000-ScipyMinimizer-numpy] 7.232413942061841 iter/sec (stddev: 0.0008395636109817931) 16.113062913278878 iter/sec (stddev: 0.0002623519931624775) 2.23
benchmarks/expression.py::test_fit[1000-ScipyMinimizer-numba] 7.16935485894597 iter/sec (stddev: 0.000611467563372948) 16.217841898876852 iter/sec (stddev: 0.0003193217998612972) 2.26
benchmarks/expression.py::test_fit[1000-ScipyMinimizer-tf] 0.6185602969451339 iter/sec (stddev: 0.004700798643981236) 1.4043607630131383 iter/sec (stddev: 0.0016402295685287915) 2.27
benchmarks/unbinned_nll.py::test_unbinned_nll_normalization_formula[original-numpy] 28.24288603456473 iter/sec (stddev: 0.0033160427205862464) 80.89992620132578 iter/sec (stddev: 0.0014910944339774205) 2.86
benchmarks/unbinned_nll.py::test_unbinned_nll_normalization_formula[original-tensorflow] 59.06725366031111 iter/sec (stddev: 0.0014476197385774605) 129.63414209598676 iter/sec (stddev: 0.0002041886279346019) 2.19
benchmarks/unbinned_nll.py::test_unbinned_nll_normalization_formula[optimized-numpy] 36.846555857601054 iter/sec (stddev: 0.0023219141135341374) 126.61085086393801 iter/sec (stddev: 0.0007772448410810061) 3.44
benchmarks/unbinned_nll.py::test_unbinned_nll_normalization_formula[optimized-tensorflow] 60.564307458148576 iter/sec (stddev: 0.0019333896871976067) 160.31611202220606 iter/sec (stddev: 0.0002920427106502862) 2.65
benchmarks/unbinned_nll.py::test_unbinned_nll_estimator[numpy] 118.81215582460706 iter/sec (stddev: 0.001514530400030229) 333.18786869068646 iter/sec (stddev: 0.0008835784608970419) 2.80
benchmarks/unbinned_nll.py::test_unbinned_nll_estimator[numba] 95.73682794608564 iter/sec (stddev: 0.0015552887862024267) 534.0952050682405 iter/sec (stddev: 0.0009391258569386208) 5.58

This comment was automatically generated by workflow using github-action-benchmark.

@redeboer
redeboer added this pull request to stack #607 November 17, 2026 22:09
@redeboer redeboer changed the title FIX: support phasespace 2.0 FIX: support phasespace v2.0 Nov 17, 2026
@redeboer
redeboer force-pushed the support-phasespace-2 branch from 27aea40 to 20851d7 Compare November 18, 2026 09:23
@redeboer
redeboer removed this pull request from stack #607 November 18, 2026 10:32
@redeboer
redeboer added this pull request to stack #610 November 18, 2026 10:33
@redeboer redeboer changed the title FIX: support phasespace v2.0 FIX: support phasespace v2.0 Nov 18, 2026
@redeboer redeboer added 📝 Docs Improvements or additions to documentation ⬆️ Lock This PR upgrades the lock files labels Nov 18, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 Bug Something isn't working 📝 Docs Improvements or additions to documentation ⚙️ Enhancement Improvements and optimizations of existing features ⬆️ Lock This PR upgrades the lock files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support phasespace v2.0

1 participant